package com.example.allow.controller;
import com.example.allow.assistant.AllowAgent;
import com.example.allow.bean.ChatForm;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@Tag(name = "AllowController", description = "AllowController")
@RestController
@RequestMapping("/allow")
public class AllowController {

    @Autowired
    private AllowAgent allowAgent;

    @Operation(summary = "chat", description = "chat")
    @PostMapping(value = "/chat",produces = "text/stream;charset=utf-8")
    public Flux<String> chat(@RequestBody ChatForm chatForm) {
        return allowAgent.chat(chatForm.getMemoryId(), chatForm.getMessage());
    }

    //

}
